﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;



namespace WindowsGame
{
    public interface IGameResourcesService
    {
		MenuResources Menu { get; }
        TerrainResources Terrain { get; }
		ObjectResources Object { get; }
		EnemiesResources Enemies { get; }
		BulletResources Bullet { get; }
        HeadUpDisplayResources HeadUpDisplay { get; }
    }



    class ResourcesHandler : Microsoft.Xna.Framework.DrawableGameComponent, IGameResourcesService
    {
		MenuResources menuResources;
        TerrainResources terrainResources;
		ObjectResources objectResources;
		EnemiesResources enemiesResources;
		BulletResources bulletResources;
        HeadUpDisplayResources headUpDisplayResources;

		public MenuResources Menu { get { return menuResources; } }
        public TerrainResources Terrain { get { return terrainResources; } }
		public ObjectResources Object { get { return objectResources; } }
		public EnemiesResources Enemies { get { return enemiesResources; } }
		public BulletResources Bullet { get { return bulletResources; } }
        public HeadUpDisplayResources HeadUpDisplay { get { return headUpDisplayResources; } }



        public ResourcesHandler(Game game)
            : base(game)
        {
            Game.Services.AddService(typeof(IGameResourcesService), this);
        }



        public override void Initialize()
        {
            base.Initialize();
        }



        protected override void LoadContent()
        {
			menuResources = new MenuResources(Game.Content);
            terrainResources = new TerrainResources(Game.Content);
			objectResources = new ObjectResources(Game.Content);
			enemiesResources = new EnemiesResources(Game.Content);
			bulletResources = new BulletResources(Game.Content);
            headUpDisplayResources = new HeadUpDisplayResources(Game.Content);
            base.LoadContent();
        }



        protected override void Dispose(bool disposing)
        {
            Game.Services.RemoveService(typeof(IGameResourcesService));

            base.Dispose(disposing);
        }
    }
}